<script>
  const userObj = {
    name: 'Linda',
    _age: 18,
    get age() {
      return this._age
    },
    set age() {

    }
  }
  function defineReactive(obj, key, value){
    Object.defineProperty(userObj, 'age', {
      get() {
        return value 
      },
      set(val) {
        if(val <= 0 || val > 30){
          value = 18
          return
        }
        value = val
      }
    })
  }
  defineReactive(userObj, 'age', userObj['age'])

  console.log(userObj.age)
  userObj.age = -1
  console.log(userObj.age)
</script>